import {GameMap} from "./gameMap.mjs";
import {Matrix} from "../utils/matrix.mjs";
import {meshgrid} from "../utils/utils.mjs";


export class PeekArea extends GameMap {
    #offsets
    array

    constructor(container, mapSize, pos) {
        super(container, mapSize);

        this.#offsets = meshgrid([-1, 0, 1])
        this.pos = pos
        this.array = this.#getPeekArray(...pos)
        this.initState(this.array)
    }

    #getPeekArray(x, y) {
        return this.#offsets.map(row =>
            row.map(([x_off, y_off]) => [x + x_off, y + y_off]))
    }

    trans() {
        this.array = Matrix.transpose(this.array)
    }
}
